﻿@model AutomatedTestDataManagement.Models.Datum

@{
    ViewBag.Title = "NewDataSchema";
}

<script type="text/javascript">
    function addField() {
        var newfields = "<div class='editor-field'>Field Name: <input type='text' name='FieldName' id=FieldName' /> Field Value: <input type='text' name='FieldValue' id='FieldValue' /></div>";
        $("#fieldset").children("div").append(newfields);
    }
</script>

<h2>New Data Record for @ViewBag.TableName</h2>

<p> This is the first record for @ViewBag.TableName. Please define table columns as well as entering data.</p>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset id="fieldset">
        <legend>Datum</legend>

        <div class="editor-field">
           <input type="hidden" name="TableMasterID" value="@ViewBag.TableMasterID" /> 
           <input type="hidden" name="DataID" value="@ViewBag.DataID" />
            Field Name: @Html.Editor("FieldName")
            Field Value: @Html.Editor("FieldValue")
            <button type="button" name="New" value="Add Field" onclick="addField();">Add new field</button>
        </div>


        <p>
            <input type="submit" id= "submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Cancel Data Entry", "Index", "Home")
</div>

        @{Html.RenderAction("_ListDataTables", "DataTable");}
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
